#include "MyQSortFilterProxyModel.h"

MyQSortFilterProxyModel::MyQSortFilterProxyModel(QObject *parent) :
	QSortFilterProxyModel(parent)
{
}

QVariant MyQSortFilterProxyModel::headerData(int section, Qt::Orientation orientation, int role) const {
	if (role == Qt::DisplayRole) {
		if (orientation == Qt::Horizontal) {
			switch (section) {
				case 0:
					return "ID";
				case 1:
					return "Name";
				case 2:
					return "Saving path";
				case 3:
					return "Priority";
				case 4:
					return "Progress";
			}
		} else {
			return section + 1;
		}
	}
	return QVariant();
}

void MyQSortFilterProxyModel::sort(int column, Qt::SortOrder order)
{
	emit layoutAboutToBeChanged();
	QSortFilterProxyModel::sort(column, order);
	emit layoutChanged();
}
